var div222 = document.querySelector(".div2-2-2");
var div221 = document.querySelector(".div2-2-1");
var div223 = document.querySelector(".div2-2-3");
var div261 = document.querySelector(".div2-6-1");
var div2312 = document.querySelector(".div2-3-1-2");
var div2412 = document.querySelector(".div2-4-1-2");
var div2511 = document.querySelector(".div2-5-1-1");
var div231 = document.querySelector(".div2-3-1");
var div241 = document.querySelector(".div2-4-1");
var pu2 = document.querySelector(".pu2");




var div28 = document.querySelector(".div2-8");

div222.addEventListener("click", function() {
    clearborder();
    this.style.borderColor = "rgb(19, 18, 18)";
    this.style.borderWidth = "2px";


})
div221.addEventListener("click", function() {
    clearborder();
    this.style.borderColor = "rgb(19, 18, 18)";
    this.style.borderWidth = "2px";


})
div223.addEventListener("click", function() {
    clearborder();
    this.style.borderColor = "rgb(19, 18, 18)";
    this.style.borderWidth = "2px";


})


function clearborder() {
    div221.style.borderColor = "rgb(192, 179, 179)";
    div221.style.borderWidth = "1px";
    div222.style.borderColor = "rgb(192, 179, 179)";
    div222.style.borderWidth = "1px";
    div223.style.borderColor = "rgb(192, 179, 179)";
    div223.style.borderWidth = "1px";
}
// 判空处理代码
div2312.addEventListener("click", function() {
    div261.disabled = false;
    div231.style.borderColor = "black";
})
div2412.addEventListener("click", function() {
    div261.disabled = false;
    div241.style.borderColor = "black";
})

pu2.addEventListener("click", function() {
    if (div2312.value.trim().length == 0) {
        div261.disabled = true;
        div231.style.borderColor = "red";
        div28.innerHTML = "用户名不能为空";
    } else {
        div231.style.borderColor = "black";
        div28.innerHTML = "";
        if (div2412.value.trim().length == 0) {
            div261.disabled = true;
            div241.style.borderColor = "red";
            div28.innerHTML = "密码不能为空";
        } else {
            div241.style.borderColor = "black";
            div28.innerHTML = "";
        }
    }

})